home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1996-01-17 | 1.6 KB | 45 lines |
- ' ************************************* Commands used:
- ' * * =Qarc
- ' * Amcaf Examples * =Qsqr
- ' * Qsin-Qcos-Qarc-Qsqr V1.0 * =Qsin
- ' * Written by Chris Hodges * =Qcos
- ' * * Blitter Clear
- ' *************************************
- '
- ' Open a nice little screen. Ntsc is supported for Gregs sanity ;-)
- Screen Open 0,320,256+Ntsc*56,2,0
- Curs Off : Flash Off : Paper 0 : Pen 1 : Cls
- ' Limit the mouse to it's boundaries.
- Wait Vbl
- Limit Mouse
- ' Now turn on double buffering... not really required, but makes the
- ' program much nicer
- Double Buffer : Autoback 0
- ' Calculate the point in the middle of the screen
- MX=Screen Width/2 : MY=Screen Height/2
- ' Main loop
- Repeat
- ' Swap screens and clear old page.
- Screen Swap : Wait Vbl
- Extension_8_121C 0,0
- ' Get the mouse coordinates.
- XM=X Screen(X Mouse) : YM=Y Screen(Y Mouse)
- ' Calculate the delta coordinates to the middle
- DX=XM-MX : DY=YM-MY
- ' The angle is calculated using the Qarc function
- ARC= Extension_8_16C2(DX,DY)
- ' Get the distance to the middle
- RAD= Extension_8_1366(DX*DX+DY*DY)
- ' Draw a line from the middle to a point in 32 pixels distance
- Draw MX,MY To MX+ Extension_8_1114(ARC,32),MY+ Extension_8_1106(ARC,32)
- ' If the radius is not zero, draw a circle around the middle
- If RAD Then Circle MX,MY,RAD
- ' Now unveil the information aquired.
- Home
- Print "Delta X:";DX;" pixels"
- Print "Delta Y:";DY;" pixels"
- Print "Radius :";RAD;" pixels"
- Print "Angle :";ARC;"=";(ARC*360)/1024;" degrees"
- Until Inkey$=Chr$(27) or Mouse Key
- Screen Close 0
- End